package com.zhuannimei.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.zhuannimei.R;

/**
 * 数据适配器基类
 * 
 * @author Jack 2013-12-3
 * 
 * 
 */
public class BaseObjectListAdapter extends BaseAdapter {

	protected ImageLoader imageLoader = ImageLoader.getInstance();
	DisplayImageOptions options = new DisplayImageOptions.Builder()
//			 .showImageOnLoading(R.drawable.ic_launcher)
			.showImageForEmptyUri(R.drawable.ic_launcher)
			.showImageOnFail(R.drawable.ic_launcher).cacheInMemory(true)
			.cacheOnDisc(true)
//			 .considerExifParams(true)
			.displayer(new RoundedBitmapDisplayer(10)).build();

	protected Context mContext;
	protected LayoutInflater mInflater;
	protected List<? extends Object> mDatas;// 数据集合

	public BaseObjectListAdapter(Context context, List<? extends Object> datas) {
		mContext = context;
		mInflater = LayoutInflater.from(context);
		if (datas != null) {
			mDatas = datas;
		}
	}

	@Override
	public int getCount() {
		return mDatas.size();
	}

	@Override
	public Object getItem(int position) {
		return mDatas.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return null;
	}

	public List<? extends Object> getDatas() {
		return mDatas;
	}

}
